import numpy as np
import pandas as pd
arr = np.random.randint(1, 20, size=(3, 3))
df = pd.DataFrame(arr, columns=['c','b','a'])
print('原始数据:\n', df)
print('按行索引降序排序:\n', df.sort_index(ascending=False))
print('按列标签升序排序:\n', df.sort_index(axis=1))